﻿#region [ License information          ]
/* ************************************************************
 *
 * Copyright (c) Bjørn Bouet Smith, 2010, 2011
 *
 * This source code is subject to terms and conditions of 
 * Microsoft Public License (Ms-PL).
 * 
 * A copy of the license can be found in the license.txt
 * file at the root of this distribution. If you can not 
 * locate the License, please send an email to bjornsmith@gmail.com
 * 
 * By using this source code in any fashion, you are 
 * agreeing to be bound by the terms of the Microsoft 
 * Permissive License.
 *
 * You must not remove this notice, or any other, from this
 * software.
 *
 * ************************************************************/
#endregion


using System.Configuration;

namespace Smith.AMC.Configuration
{
    /// <summary>
    /// Represents a single memcached server node
    /// </summary>
    public class MemcachedServerNodeConfiguration : ConfigurationElement
    {
        /// <summary>
        /// Gets or sets the hostname of the memcached server
        /// </summary>
        [ConfigurationProperty("hostname", IsRequired = true, DefaultValue = "localhost")]
        public string HostName
        {
            get
            {
                return (string)this["hostname"];
            }
            set
            {
                this["hostname"] = value;
            }
        }

        /// <summary>
        /// Gets or sets the TCP port number the memcached server node is listening on
        /// </summary>
        [ConfigurationProperty("tcpport", IsRequired = false, DefaultValue = 11211)]
        [IntegerValidator(MinValue = 10000, MaxValue = 65536)]
        public int TcpPortNumber
        {
            get
            {
                return (int)this["tcpport"];
            }
            set
            {
                this["tcpport"] = value;
            }
        }

        /// <summary>
        /// Gets or sets the UDP port number the memcached server is listening on.
        /// </summary>
        [ConfigurationProperty("udpport", IsRequired = false, DefaultValue = 11212)]
        [IntegerValidator(MinValue = 10000, MaxValue = 65536)]
        public int UdpPortNumber
        {
            get
            {
                return (int)this["udpport"];
            }
            set
            {
                this["udpport"] = value;
            }
        }
    }
}
